package com.example.libraryapp.fragment.category;

import com.example.libraryapp.bean.BookType;
import com.example.libraryapp.bean.response.BaseResponse;
import com.example.libraryapp.network.base.BaseHttpHandler;
import com.example.libraryapp.network.base.BasePresenter;

import java.util.List;

/**
 * @author 伍凯铭
 * @since 2020/6/19
 */
public class CategoryPresenterIml extends BasePresenter<CategoryContract.View> implements CategoryContract.Presenter{

    @Override
    public void getAllBookType() {
        super.doRequest(getRequestService().getAllBookType(),new GetTypeHandler());
    }

    class GetTypeHandler extends BaseHttpHandler<BaseResponse<List<BookType>>> {

        GetTypeHandler() {
            super(mView);
        }

        @Override
        public void onSuccess(BaseResponse<List<BookType>> response) {
            if(mView != null) {
                mView.showContent();
                mView.showAllBookType(response);
            }
        }
    }
}
